package com.sdy.dao.mysql;

import com.sdy.po.OrderItem;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface OrderItemMapper {

    List<OrderItem> getAll();

    Boolean update(@Param("orderItem")OrderItem orderItem);

    Boolean insert(@Param("orderItem")OrderItem orderItem);

    Boolean delete(@Param("id")Integer id);

    @Select("select id,orderId,productId,number,discount,state,specificationId from po_orderitem where orderId = #{id}")
    @Results({
            @Result(column = "productId",property = "productId"),
            @Result(column = "productId",property = "product",one = @One(select = "com.sdy.dao.mysql.ProductMapper.getAbstractOne"))
    })
    List<OrderItem> getListByOrderId(@Param("id") Integer id);

}
